<%@ include file="/taglibs.jsp"%>
<html>
<head>
    <title><fmt:message key="fileForm.title"/></title>
	<link rel="stylesheet" type="text/css" href="${ctx}/styles/styles_tab.css" />
</head>
<body>
		<div>
		    <ul class="tabs">
		        <li><a href="#tab1"><s:property value="getText('file.info')"/></a></li>
		        <li><a href="#tab2"><s:property value="getText('file.progress')"/></a></li>
		        <li><a href="#tab3"><s:property value="getText('file.exchange.info')"/></a></li>
		    </ul>
		    <div class="tab_container">
		        <div id="tab1" class="tab_content">
		
			<s:form name="transferFileMgrForm" action="transferFileMgr" method="post" validate="true">
			<s:hidden name="id" value="%{file.id}"/>
			<fieldset>
			    <legend><s:text name="file.detail.title1"></s:text>:</legend>
			    <s:text name="file.field"></s:text>: <s:property value="field.name"/><br />
			    <s:text name="file.category"></s:text>: <s:property value="file.category.categoryName"/><br />
			</fieldset>
			
			<fieldset>
			    <legend><s:text name="file.detail.title2"></s:text>:</legend>
			    <s:text name="file.sender"></s:text>: <s:property value="file.sender"/><br />
			    <s:text name="file.senderPhone"></s:text>: <s:property value="file.senderPhone"/><br />
			    <s:text name="file.organization"></s:text>: <s:property value="file.organization"/><br />
			    <s:text name="file.orgPhone"></s:text>: <s:property value="file.orgPhone"/><br />
			</fieldset>
			
			<fieldset>
			    <legend><s:text name="file.detail.title3"></s:text>:</legend>
			    <s:text name="file.inputDate"></s:text>: <s:property value="file.inputDate"/><br />
			    <s:text name="file.outputDate"></s:text>: <s:property value="file.outputDate"/><br />
			</fieldset>
			
			<fieldset>
			    <legend><s:text name="file.detail.title4"></s:text>:</legend>
			    <s:text name="file.content"></s:text>: <s:property value="file.content"/><br />
			    <s:text name="file.attach"></s:text>: <s:property value="@org.apache.commons.lang.StringUtils@join(attachFiles, ', ')"/><br />
			    <s:text name="file.otherAttachFiles"></s:text>: <s:property value="file.otherAttachFiles"/><br />
			</fieldset>
			
			<s:set var="fileStatus" value="file.fileStatus"></s:set>
			
			<fieldset>
			    <legend><s:text name="file.detail.title5"></s:text>:</legend>
			    <s:text name="fileStatus.items_name"></s:text>: <s:property value="#fileStatus.status"/><br />
			    <s:text name="file.createdBy"></s:text>: <s:property value="file.createdBy.username"/><br />
			</fieldset>
			
			
			<s:url action="exportReceipt" var="exportReceiptURL">
				<s:param name="id" value="%{file.id}"></s:param>
			</s:url>
			
			<s:url action="editFile" var="editFileURL">
				<s:param name="id" value="%{file.id}"></s:param>
			</s:url>
			
			<s:url action="default" namespace="/" var="backToFileListURL"/>

			<tr>
			    <td></td>
			    <td>
			        <s:submit cssClass="button" name="transfer" value="%{getText('button.return.title')}" theme="simple" onclick="form.onsubmit=null"></s:submit>
			    </td>  
			</tr>
			</s:form>
        </div>
        
        <div id="tab2"  class="tab_content"> 
		    <table>
			    <s:iterator value="fileManagements" var="item">
				   <h6><s:property value="%{#item[0]}" /><br/></h6>
				   &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="%{#item[2]}" />
				   &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="%{#item[1]}" />
				</s:iterator> 
		        <s:iterator value="fileManagements">
		            <tr>
		                <td>
		                	<h6><s:property value="username" /></h6>
		                </td>
		                <td>
							<s:property value="%{approved_date}"/>
			        	</td>                
		            </tr>        
		            <tr>
		                <td>&nbsp;&nbsp;&nbsp;&nbsp;
		                	<s:property value="%{status}"/>
		                </td>
		            </tr>
		        </s:iterator>
		    </table>
        </div>        
        
        <div id="tab3"  class="tab_content"> 
		    <table>
		        <s:iterator value="exchanges">
		            <tr>
		                <td>
		                <s:iterator value="user">
		                	<h6><s:property value="%{firstName}" /> <s:property value="%{lastName}" /></h6>
		                </s:iterator>
		                </td>
		                <td>
							<s:property value="%{date}"/>
			        	</td>                
		            </tr>        
		            <tr>
		                <td>&nbsp;&nbsp;&nbsp;&nbsp;
		                	<s:property value="%{comment}"/>
		                </td>
		            </tr>
		        </s:iterator>

				<s:form name="exchangeForm" action="saveExchange" method="post" validate="true">
				<s:hidden name="id" value="%{file.id}"/>
		        <tr>
				    <td>
				    	<s:textarea key="comment" cols="50" rows="7" theme="simple" />
				    </td>
				</tr>		
				<tr>
				    <td>
				    	<s:submit cssClass="button" name="save" value="%{getText('button.save.title')}" theme="simple" onclick="form.onsubmit=null"></s:submit>
				    </td>
				</tr>
				</s:form>
		    </table>
        </div>

    </div>
</div>

	<script type="text/javascript">
	
	$(document).ready(function() {
	
		//Default Action
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		
		//On Click Event
		$("ul.tabs li").click(function() {
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active content
			return false;
		});
	
	});
	</script>
</body>
</html>





